Skip to content

Split the monolith gui.py into a focused package#84

Merged
RenanGBarreto merged 6 commits into
mainfrom
feat/fix-ui-commands
Jul 7, 2026
Merged

Split the monolith gui.py into a focused package#84
RenanGBarreto merged 6 commits into
mainfrom
feat/fix-ui-commands

Conversation

@RenanGBarreto

@RenanGBarreto RenanGBarreto commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Split the monolith gui.py into a focused package

🤔 Why?

  • The single mkpfs/gui.py file had grown past 1800 lines. Mixing theme config, translations, widgets, and six different operation panels in one file made it hard to navigate and risky to edit.

🔧 What changed

  • The GUI is now organized as a gui/ package with one file per concern: theme.py, i18n.py, widgets.py, app.py, and a panels/ folder with a module for each operation.
  • The old mkpfs/gui.py was removed. The mkpfs-gui entry point still works because gui/__init__.py re-exports main() from app.py.
  • CI build scripts were updated to point PyInstaller at the new entry point.

🧪 How to test

💬 Notes for non-technical readers

  • Nothing changed from a user perspective. All the same buttons, panels, and behaviors are still there — just the internal file layout is cleaner.

The single mkpfs/gui.py file had grown to 1843 lines mixing translations,
theme, widgets, and six distinct operation panels. This refactor splits it
into a gui/ package with clear separation of concerns:

- gui/i18n.py — translations and locale state
- gui/theme.py — palette, fonts, and panel accent color
- gui/widgets.py — reusable UI components
- gui/panels/ — one module per operation (pack_folder, pack_file,
  verify, inspect, tree, unpack) plus a shared base class
- gui/app.py — MkPFSApp and main() entry point
- gui/__init__.py — re-exports main() for the mkpfs-gui entry point

No user-facing changes. The old gui.py is deleted.
Copilot AI review requested due to automatic review settings July 7, 2026 00:51
@github-code-quality

github-code-quality Bot commented Jul 7, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest

The overall coverage in the branch is 74%. The coverage in the branch is 75%.

Show a code coverage summary of the most impacted files.
File 3c9064e b34223b +/-
gui/__init__.py 0% 0% 0%
gui/app.py 0% 0% 0%
gui/i18n.py 0% 0% 0%
gui/panels/__init__.py 0% 0% 0%
gui/panels/base.py 0% 0% 0%
gui/panels/inspect.py 0% 0% 0%
gui/panels/pack_file.py 0% 0% 0%
gui/panels/pack_folder.py 0% 0% 0%
gui/panels/tree.py 0% 0% 0%
gui/panels/unpack.py 0% 0% 0%

Updated July 07, 2026 03:18 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors GUI from monolithic mkpfs/gui.py into structured mkpfs/gui/ package, separating i18n, theme, widgets, and per-operation panels to make GUI code easier to navigate and maintain while keeping mkpfs-gui entrypoint working.

Changes:

  • Split GUI into mkpfs/gui/ package (theme + i18n + widgets + app + panels + base panel).
  • Moved each operation into its own panel module under mkpfs/gui/panels/; deleted old mkpfs/gui.py.
  • Repo housekeeping: add pi-task artifacts/ignores and tweak ignore/docs files.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mkpfs/gui/widgets.py New reusable widget layer (cards, rows, buttons, log pane, nav button).
mkpfs/gui/theme.py Centralized GUI palette/fonts + per-panel accent map.
mkpfs/gui/i18n.py Centralized translations, locale state, and tr() helper.
mkpfs/gui/app.py Main MkPFSApp window + sidebar/nav + main() entrypoint.
mkpfs/gui/init.py Re-export main() to preserve CLI entrypoint behavior.
mkpfs/gui/panels/base.py Shared BasePanel with logging, threading, and in-process CLI runner.
mkpfs/gui/panels/pack_folder.py Pack-folder panel extracted to its own module.
mkpfs/gui/panels/pack_file.py Pack-file panel extracted to its own module.
mkpfs/gui/panels/verify.py Verify panel extracted to its own module.
mkpfs/gui/panels/inspect.py Inspect panel extracted to its own module.
mkpfs/gui/panels/tree.py Tree panel extracted to its own module.
mkpfs/gui/panels/unpack.py Unpack panel extracted to its own module.
mkpfs/gui/panels/init.py Panel package exports for app wiring.
mkpfs/gui.py Deleted old monolithic GUI module.
AGENTS.md Add “token efficiency” guidance for agents.
.pi-tasks/TASK_AUTO_0001.md Add tracked task record describing refactor plan/decisions.
.pi-tasks/.ignore Add ripgrep/fd ignore rules for .pi-tasks/.
.graphifyignore Add graphify ignore rules.
.gitignore Add/update ignore patterns (including .pi-tasks/).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mkpfs/gui/widgets.py Outdated
Comment thread mkpfs/gui/panels/base.py Outdated
Comment thread mkpfs/gui/panels/base.py
Comment thread mkpfs/gui/app.py Outdated
Comment thread mkpfs/gui/i18n.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Dismissed
The old monolithic mkpfs/gui.py was deleted during the GUI refactor.
PyInstaller entry points now point to mkpfs/gui/__init__.py which
re-exports main() from the new gui/app.py module.
@RenanGBarreto RenanGBarreto changed the title Split the large gui.py into a maintainable package structure Split the monolith gui.py into a focused package Jul 7, 2026
- Remove unused _BG_*, _TEXT_*, _SUCCESS constants from theme.py
- Remove unused _LANG_NAMES from i18n.py
- Fix pip install suggestion to use uv sync --group dev
- Consolidate duplicate Entry point header in app.py
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
Comment thread mkpfs/gui/theme.py Fixed
The automated review flagged theme.py constants and _LANG_NAMES as
unused because CodeQL analyzed each source file in isolation. Every
constant is actively imported and used across gui/ submodules.

Also keep two genuine review fixes:
- Remove duplicate kwargs.setdefault in widgets.py
- Remove redundant export_btn.configure in base.py
- Fix uv hint to say 'uv sync' (cryptography is a project dep)
Comment thread mkpfs/gui/i18n.py
},
}

_LANG_NAMES: dict[str, str] = {
Comment thread mkpfs/gui/theme.py
"""Neon glassmorphism theme constants for the mkpfs GUI."""

# Backgrounds — deep space
_BG_DEEP = "#0B0E17" # deepest background
Comment thread mkpfs/gui/theme.py

# Backgrounds — deep space
_BG_DEEP = "#0B0E17" # deepest background
_BG_PANEL = "#121626" # card / panel body
Comment thread mkpfs/gui/theme.py
# Backgrounds — deep space
_BG_DEEP = "#0B0E17" # deepest background
_BG_PANEL = "#121626" # card / panel body
_BG_CARD = "#181E2D" # inner card
Comment thread mkpfs/gui/theme.py
_BG_DEEP = "#0B0E17" # deepest background
_BG_PANEL = "#121626" # card / panel body
_BG_CARD = "#181E2D" # inner card
_BG_INPUT = "#1A2035" # text input / textbox bg
Comment thread mkpfs/gui/theme.py
_BG_PANEL = "#121626" # card / panel body
_BG_CARD = "#181E2D" # inner card
_BG_INPUT = "#1A2035" # text input / textbox bg
_BORDER_BRIGHT = "#2B3553" # bright border accent
Comment thread mkpfs/gui/theme.py
_BG_CARD = "#181E2D" # inner card
_BG_INPUT = "#1A2035" # text input / textbox bg
_BORDER_BRIGHT = "#2B3553" # bright border accent
_TEXT_PRIMARY = "#E8EDF5" # primary text
Comment thread mkpfs/gui/theme.py
_BG_INPUT = "#1A2035" # text input / textbox bg
_BORDER_BRIGHT = "#2B3553" # bright border accent
_TEXT_PRIMARY = "#E8EDF5" # primary text
_TEXT_SECONDARY = "#8892B0" # secondary text
Comment thread mkpfs/gui/theme.py
_BORDER_BRIGHT = "#2B3553" # bright border accent
_TEXT_PRIMARY = "#E8EDF5" # primary text
_TEXT_SECONDARY = "#8892B0" # secondary text
_TEXT_MUTED = "#4A5580" # muted text
Updated .gitignore to include and exclude specific directories and files.
@RenanGBarreto RenanGBarreto merged commit 49ac169 into main Jul 7, 2026
12 checks passed
@RenanGBarreto RenanGBarreto deleted the feat/fix-ui-commands branch July 7, 2026 03:20
RenanGBarreto added a commit that referenced this pull request Jul 7, 2026
Resolve modify/delete conflict on AGENTS.md by keeping the deletion
(CLAUDE.md is the canonical home). Fold main's new Token efficiency
section into CLAUDE.md. Update worktree map to reflect the gui.py ->
gui/ package split from PR #84.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants